<?php 
	//$this->headScript()->appendFile( $this->baseUrl() . '/public/js/jquery.flip.min.js' );
	echo $this->inlineScript()->setScript( '
		var productsId = ' . $this->p_id . '; 
		editProduct();
	' ); 
?>

<?php if( $this->magazine ) { ?>
<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpmagazine">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/tick_16.png);" class="inb">Zakończ zarządzanie stanami</div>
			</a>
		</td>
	</tr>
</table>
<?php } else { ?>
<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpproducts/item/id/<?php echo $this->p_id; ?>">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/left_16.png);" class="inb">Wróć do poprzedniego formularza</div>
			</a>
		</td>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpproducts">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/tick_16.png);" class="inb">Zakończ dodawanie</div>
			</a>
		</td>
	</tr>
</table>
<?php } ?>

<div class="bglist">
	<div class="bglistq">
		<h2>Lista: wymiarów:</h2>
		<table id="dlist" cellspacing="1" cellpadding="6" class="tlist">
			<tr>
				<th>Nazwa</th>
				<th>Akcje</th>
			</tr>
			<?php 
			if( $this->dimensionList ) {
				foreach( $this->dimensionList as $item ) { 
				?>
				<tr id="tr_<?php echo $item['d_id'] ?>">
					<td><?php echo $item['name'] ?></td>
					<td>
						<a href="<?php echo $this->baseUrl() ?>/cpproducts/editdimension/id/<?php echo $item['d_id'] ?>" class="edit">Edytuj</a>
						<a href="<?php echo $this->baseUrl() ?>/cpproducts/deletedimension/id/<?php echo $item['d_id'] ?>" class="delete">Usuń</a>
					</td>
				</tr>
			<?php 
				}
			} else {		 
			?>
			<tr id="emptydlist">
				<td colspan="2">brak rekordów</td>
			</tr>
			<?php } ?>
		</table>
	</div>
</div>

<form id="formitem" action="<?php echo $this->baseUrl() ?>/cpproducts/item2'/id/<?php echo $this->p_id?>" method="post">
<input type="hidden" name="products_p_id" value="<?php echo $this->p_id ?>" />
<input type="hidden" name="d_id" value="" />
<div id="dform">
	<table cellspacing="0" cellpadding="6" class="tform">
		<tr>
			<td colspan="2" class="inpy">
				<a id="dimension" style="width: 150px;" class="button" href="javascript:void(null)">
					<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/plus_16.png);" class="inb">Zapisz wymiar</div>
				</a>
			</td>
		</tr>
		<tr>
			<td class="lb">Nazwa:</td>
			<td class="inpy">
				<input type="text" name="name" value="<?php echo $this->name ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">X:</td>
			<td class="inpy">
				<input type="text" name="x" value="<?php echo $this->x ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Y:</td>
			<td class="inpy">
				<input type="text" name="y" value="<?php echo $this->y ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Z:</td>
			<td class="inpy">
				<input type="text" name="z" value="<?php echo $this->z ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Waga:</td>
			<td class="inpy">
				<input type="text" name="weight" value="<?php echo $this->weight ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Symbol:</td>
			<td colspan="2" class="inpy"><input type="text" name="symbol" value="<?php echo $this->symbol ?>" /></td>
		</tr>
		<tr>
			<td class="lb">Stan magazynowy:</td>
			<td class="inpy">
				<input type="text" name="stock" value="<?php echo $this->stock ?>" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi 1:</td>
			<td class="inpy">
				<input type="text" name="price1" value="" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi 2:</td>
			<td class="inpy">
				<input type="text" name="price2" value="" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi 3:</td>
			<td class="inpy">
				<input type="text" name="price3" value="" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi 4:</td>
			<td class="inpy">
				<input type="text" name="price4" value="" />
			</td>
		</tr>
		<tr>
			<td class="lb">Cena dla rangi VIP:</td>
			<td class="inpy">
				<input type="text" name="price5" value="" />
			</td>
		</tr>
	</table>
</div>
</form>
<?php if( !$this->magazine ) { ?>
	<div id="lettercontent">
	<?php echo $this->inlineScript()->setScript('
		$(document).ready(function(){
			$.post(
				baseUrl + "/cpproducts/getproducts",
				{
					id : ' . $this->p_id . '
				},
				function( resp ) {
					$( "#lettercontent" ).append( resp );
					linkProduct();
				}
			);
		});
	') ?>
	</div>
<?php } ?>

<?php if( $this->magazine ) { ?>
<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpmagazine">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/tick_16.png);" class="inb">Zakończ zarządzanie stanami</div>
			</a>
		</td>
	</tr>
</table>
<?php } else { ?>
<table>
	<tr>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpproducts/item/id/<?php echo $this->p_id; ?>">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/left_16.png);" class="inb">Wróć do poprzedniego formularza</div>
			</a>
		</td>
		<td>
			<a class="button" href="<?php echo $this->baseUrl() ?>/cpproducts">
				<div style="background:url(<?php echo $this->baseUrl() ?>/public/images/tick_16.png);" class="inb">Zakończ dodawanie</div>
			</a>
		</td>
	</tr>
</table>
<?php } ?>